import roslibpy

class SetGroundModel:

    def __init__(self, framework):
        self.framework = framework
        self.talker = None
        self.ground_model = 4

    def set(self, ground_model):
        if self.framework.framework.utils.device.device_state:
            self.ground_model = ground_model
            self.talker = roslibpy.Topic(self.framework.framework.utils.device.device_connect, "/alphadog_node/set_ground_model", "ros_alphadog/SetGroundModel")
            self.talker.publish(roslibpy.Message({"ground_model": self.ground_model}))
            self.end()

    def end(self):
        self.ground_model = 4
